package com.example.productconsumer.controller;

import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @ClassName ProductController
 * @Description TODO
 * @Author yaozhaobao
 * @Date 2020/12/6 14:01
 * @Version 1.0
 **/
@RestController
public class ProductService {


    @RequestMapping(value = "/productbyid",method = RequestMethod.GET)
    public String getProductionById(@RequestParam("id")String id){
        return "获取商品id为"+id+"数据";
    }

    @RequestMapping("/addpro")
    public String add(@RequestParam("name") String name,@RequestParam("price")int price){
        return "保存商品到数据库"+name+"价格是"+price;
    }


    @RequestMapping("/addpro2")
    public String add2(@RequestBody  Map map){
        return "保存商品到数据库"+map.get("name")+"价格是"+map.get("price");
    }
}
